﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UTable.Objects.Controls">
    <Style TargetType="{x:Type local:UCheckBox}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="15"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="Padding" Value="5,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:UCheckBox}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="ThreeStateExit">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="Press">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-3"/>
                            </ThicknessAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="Checked">
                            <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/>
                        </Storyboard>
                        <Storyboard x:Key="Release">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                            <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-3"/>
                                <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1"/>
                            </ThicknessAnimationUsingKeyFrames>
                        </Storyboard>
                        <Storyboard x:Key="Unchecked">
                            <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/>
                        </Storyboard>
                        <Storyboard x:Key="ThreeStateEnter">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.9"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <BulletDecorator x:Name="bulletDecorator" MinHeight="30" MinWidth="30" Height="Auto" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="Transparent">
                        <BulletDecorator.Bullet>
                            <Grid MinHeight="30" MinWidth="30" Width="30" Height="30" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                <Rectangle x:Name="Base" Fill="{TemplateBinding Background}" Stroke="Transparent" StrokeThickness="1" RadiusX="7" RadiusY="7" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                <Rectangle x:Name="Button" Fill="#33A4B4BD" StrokeThickness="1" RadiusX="7" RadiusY="7" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                            <GradientStop Color="#66000000" Offset="0"/>
                                            <GradientStop Color="#33000000" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                </Rectangle>
                                <Rectangle x:Name="RenderOverlay" StrokeThickness="1" RadiusX="6" RadiusY="6" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                            <GradientStop Color="#7FFFFFFF" Offset="0"/>
                                            <GradientStop Color="#0CFFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                    <Rectangle.Fill>
                                        <RadialGradientBrush GradientOrigin="0.627,0.5">
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="-2.056" ScaleY="-4.033"/>
                                                    <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                                                    <RotateTransform Angle="90.17" CenterX="0.5" CenterY="0.5"/>
                                                    <TranslateTransform X="-0.016" Y="-0.429"/>
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#19000000" Offset="0.205"/>
                                            <GradientStop Color="#0CFFFFFF" Offset="0.652"/>
                                        </RadialGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Path x:Name="Checkmark" Fill="{x:Null}" Stretch="Fill" StrokeEndLineCap="Flat" StrokeStartLineCap="Flat" StrokeThickness="4" HorizontalAlignment="Stretch" Margin="7.96,11.023,7.999,8.187" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Data="M4.2195036,10.149215L9.4262573,13.556164 17.449568,5.9264725 17.449648,6.780637 9.3715682,13.987686 4.2190426,11.048134z">
                                    <Path.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                            <GradientStop Color="#FF292929" Offset="0.5"/>
                                            <GradientStop Color="#FF1B1B1B" Offset="0.196"/>
                                        </LinearGradientBrush>
                                    </Path.Stroke>
                                </Path>
                                <Rectangle x:Name="ThreeStateMark" StrokeThickness="1" RadiusX="4" RadiusY="4" Margin="6" Opacity="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                                    <Rectangle.Stroke>
                                        <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                            <GradientStop Color="#66000000" Offset="0"/>
                                            <GradientStop Color="#33000000" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Stroke>
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                            <GradientStop Color="#FF292929" Offset="0.5"/>
                                            <GradientStop Color="#FF1B1B1B" Offset="0.196"/>
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="Glow" Opacity="0" RadiusX="9" RadiusY="9" Margin="3" Fill="{TemplateBinding GlowBrush}">
                                    <!--Rectangle.BitmapEffect>
                                        <OuterGlowBitmapEffect GlowColor="White" GlowSize="8"/>
                                    </Rectangle.BitmapEffect-->
                                </Rectangle>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <Grid Margin="5,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Grid x:Name="ContentBox" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="Transparent">
                                <ContentPresenter x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                            </Grid>
                        </Grid>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsThreeState" Value="True"/>
                                <Condition Property="IsChecked" Value="{x:Null}"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ThreeStateMark" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.9"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="IsChecked" Value="False">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Duration="00:00:00.2000000" Storyboard.TargetName="Checkmark" Storyboard.TargetProperty="Opacity" To="0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="3"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00.1000000" Value="-1"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="3"/>
                                            <SplineDoubleKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Glow" Storyboard.TargetProperty="(FrameworkElement.Margin)">
                                            <SplineThicknessKeyFrame KeyTime="00:00:00" Value="-1"/>
                                            <SplineThicknessKeyFrame KeySpline="0.5,0.5,0.5,1" KeyTime="00:00:00.5000000" Value="1"/>
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Fill" TargetName="Button" Value="#00000000"/>
                            <Setter Property="Stroke" TargetName="Button" Value="#33000000"/>
                            <Setter Property="Foreground" Value="#A5333333"/>
                            <Setter Property="Fill" TargetName="RenderOverlay" Value="#00000000"/>
                            <Setter Property="Stroke" TargetName="Checkmark" Value="#33000000"/>
                            <Setter Property="Opacity" TargetName="RenderOverlay" Value="0.5"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>